<template>
    <view class="chaX">
        <uv-cell-group :border="false" :customStyle="{ background: '#fff', borderRadius: '0rpx' }">
            <uv-cell :border="true" title="乡镇名称" :value="formData.Town"></uv-cell>
            <uv-cell :border="true" title="巡查对象ID" :value="formData.ObjectId"></uv-cell>

            <uv-cell :border="true" title="巡查时间" :value="formData.Xcsj"></uv-cell>

            <uv-cell :border="true" title="巡查天气" :value="formData.Xctq"></uv-cell>

            <uv-cell :border="true" title="位置">
                <template v-slot:label>
                    <uv-textarea :customStyle="{
                        background: '#edf2fa',
                        border: 'none',
                        marginTop: '20rpx',

                    }" placeholder="" disabled v-model="formData.Place"></uv-textarea>
                </template>
            </uv-cell>
            <uv-cell :border="true" title="经度" :value="formData.Lon"></uv-cell>
            <uv-cell :border="true" title="纬度" :value="formData.Lat"></uv-cell>
        </uv-cell-group>
    </view>
    <view class="chaX">
        <uv-cell-group :border="false" :customStyle="{ background: '#fff', borderRadius: '0rpx' }">
            <!-- 其他信息 -->

            <uv-cell :border="true" title="填表人" :value="formData.Tbr"></uv-cell>
            <uv-cell :border="true" title="巡查内容">
                <template v-slot:label>
                    <uv-textarea :customStyle="{
                        background: '#edf2fa',
                        border: 'none',
                        marginTop: '20rpx',
                    }" placeholder="" height='188rpx' disabled v-model="formData.Xcnr"></uv-textarea>
                </template>
            </uv-cell>
            <uv-cell :border="true" title="现场处置及建议">
                <template v-slot:label>
                    <uv-textarea :customStyle="{
                        background: '#edf2fa',
                        border: 'none',
                        marginTop: '20rpx',
                    }" placeholder="" height='188rpx' disabled v-model="formData.Xccz"></uv-textarea>
                </template>
            </uv-cell>
            <uv-cell :border="true" title="巡查照片" value="">
                <template v-slot:label>
                    <view class="df ac jsa mt-10">
                        <view v-for="(item, index) in fileList">
                            <wd-img :src="item.url" radius="12rpx" width="200rpx" height="200rpx"
                                :enable-preview="true">
                                <template v-slot:error>
                                    <view style="font-size: 24rpx;">无速报图</view>
                                </template>
                            </wd-img>
                        </view>
                    </view>
                </template>
            </uv-cell>
            <!-- <uni-forms-item label="巡查照片" name="FileIds">
					<u-upload ref="sbUpload" max-count="3" :file-list="fileList" :auto-upload="true"
						:deletable="formOperType != SYSFORMOPERTYPE.View" :header="headers" :action="uploadAction"
						@on-remove="uploadRemove" @on-success="uploadSuccess" :form-data="uploadFormData"></u-upload>
				</uni-forms-item> -->


        </uv-cell-group>
    </view>
</template>

<script lang="ts" setup>
import { XcxxLook_API } from '@/server/home'
let objId = ''
onLoad((options) => {
    objId = options.id
    objId && initTask()
})
const formData = ref({
    Town: '',
    TownCode: '',
    Xctq: null,
    Place: '',
    Lon: null,
    Lat: null,
    LonLat: '',
    Xcsj: null,
    Xcry: '', //巡查人员
    ObjectId: '',
    Xcnr: '',
    Xccz: null,
    Tbr: '',
    Remark: '',
    FileIds: []
})
const uploadFormData = ref({
    TypeCode: "ZQSB",
    FKey: "",
})
const fileList = ref([])
const initTask = async () => {
    const res = await XcxxLook_API(objId)
    if (res.IsSuccess) {
        formData.value = res.Data
        formData.value.Xcsj = res.Data.Xcsj.replace("T", " ")
        uploadFormData.value.FKey = res.Data.Id;
        //处理图片
        if (formData.value.FileIds != null && formData.value.FileIds.length > 0) {
            fileList.value = formData.value.FileIds.map(item => {
                return {
                    id: item,
                    url: import.meta.env.LH_FILE_BASEURLDZFZ + item
                }
            });
        }

    } else {
        uni.$uv.toast(res.Message)
    }
}

</script>

<style lang="scss" scoped>
page {
    background: #f5f5f5;
}

.chaX {
    padding: 20rpx 20rpx;

    .buleS {
        color: #4481e6;
        text-decoration: underline;
        margin-left: 20rpx;
    }
}
</style>
